Fix improper test for undefined