adding error handling in verify