Bug while giving strange coordinates that made it crash while setting region. Now it checks that the region is valid before setting the region.