add testing files, fixed some concurrency issues.