Fix for django psycopg2 error