fix a bug add some debugging info