Fixed a null reference exception