misc fixes for sqlite