Fix for issue with latest versions of postgres. requires explicit type casting