minor fixes in debug version
some modification on the debug version