set active region before calculating bounds
apply code review
Merge pull request #232 from Animatron/edit-5891

set active region before calculating bounds