fixing null ref exc