Adding type cast fix for PG