refactor code abit
catch reach limit error