nullpointer bug fix