works well in single threaded env fails when threadpool