fixing region setting and error recovery