added catch null pointer