Fix benign exceptions with null checks