fix function order