Fix tool not switching to correct geometry when switching between layers in edit mode