fix null checks