More defensive null checks