fixes IntegrityError bug