Fixed obscure null checks.