fix sql for regions