Fixed slight syntax errors (undefined variables, == vs =)