update some code of sub function