Fix bug caused by very long regions in input