fixed a null reference exception.