attempt at bugfix for integrityerror, but hard to test