changed makefile so it creates a debug build
made a lock for dumps from multi threadding