Issue with If and If Else in correlation with tables