change the order of some functions