fix order problem with postgres