changed order in if