Expand variable in if statement

Seems tha this is the right way to do it.