Thread unsafe implementation for debug version

not unit tested yet