Fix checks for undefined/null.