add protection against stupid debugger in all allocator routines
some small refactring