Prisons will introduce enhanced checks before inmates are released, after a sex offender was mistakenly freed.