fixes for postgres and ubuntu 12.04