Fix the linear scans in map building.

This can race but the results are idempotent.