Fix multi-thread exception.