add null pointer exception guard