Fixed a crash upon selecting a region