fixing null ref