fix bug with zero length region code