fixing null bug