Syntax error in long conditional