fixed reordering functions