fix verify and refactor