fix reverse ordering bug when prepending