add region handling; currently can't leave region 1
fix z bug which caused planner to be stuck in region 1