Looking to fix null pointer issue