Bugfix in selection sizing code (restrict selection to image boundaries)