Merge "Fix crash when modifying Selection" into pi-dev