added simple null checks