Fixed a code rearrange