Jbau db integrity fix

fix #1917 

Follow along on #1917 to figure out why! It's actually sorta fun, in a ultra-nerdy way.