Invalid termination of if statement