fix creat tender logic and refactor some code