fix region un/combine, based on a patch by Tom Brand