add multithread test and fix concurrency issue with asm factory