fixed a small nullpointer bug