improving exception prevention through null checks