switch bak some code to the right place.