trying to fix null pointer error before it errors