add some debug to find the cause of the nullpointer exception