fixed var in if check