fixing null reference