fix nullpointer bug