Clerical error allows man to avoid serving sentence for 17 years