bug fix for reordering