update code for fix bug