improve some code.