possible null reference exception fix