Solved some concurrency errors