fix retrieving null bug