fixed compatibility with psycopg 2.4