Fixes for sqlite table rebuild