Tweaked sql to sort by id ASC as a fallback even if DESC is set for order-direction.
Fixed a typo causing order-direction loaded from config to always be DESC.