Remove a redundant if and fix a syntax error