fixes bad check for undefined