Fixed null checks