a little optimize code