check errors, use once
refactor