add some checks that i saw in the pgsql module