fixing null handling