Minor bug fix for auto detecting region