Added a flag to initialize the mapping thread correctly.