Fixes check of variables
Fixes error message for missing other cases