fix null reference exception