Fixed Bug in Turning off the lamp

There was a bug in the code, the lamp didn't turn off properly because
of bad syntax with the if statements.