added test stuff, fixed a concurrency bug