fix bug and add region selection