Fixes casting text to int on PgSQL