fixed a bug in the verification function