Fixed bugs with region