Adding a temporary fix for the lack of in-database sorting.