some debugging and stats