fix backwards NULL check