clean up code related to null pointers