various bug fixes related to regions