fix functions order