fix region not defined bug