fixed ordering for postgres