Fix compilation for 64-bit platform (done issue #151)
Fix lock errors and empty slot counter
Add cleanup of events memory on element deletion
Fix bug in iterator3
Fix elements deletion
Fix compilation flags for release
Improve threading test