Fix check for undefined