Fixed major concurrency issues