Bug fix: thread synchronization in mapper.