Measurement fixes

Fixes problem when switching tools (pan, zoom) after using measurement while not all layers have been fully loaded.