Added quoting around variables in if statements.