fixed the verify function