Changed order statement for postgresql. Fixes #24