Bug fix for mask length >=5 - produces edge with double digits so can't treat edge values as single characters