fixed reordering bug