refactor common.js and add tryCall function