sorting height classes correctly

The height classes were not sorted and so were being placed into the
report randomly. This is fixed. I also added a check to look for psql,
so that I won't have to keep modifying the source code to make it run on
both mine and Esa's machine.