added unsigned long support for logger
removed mutex locking
probably fixed a random bug (stable after 30 iterations), redone wait conditions and waits