Fixing the pg error