Added lock to ID generator because of concurrency problems in Tests
Cleanup