fixed nullpointer bug