added null checks in builder class