fixes incorrect sorting of last delivery and orders