handle null reference exception