modify function to examine whether region is active or not