Fix sqlite issues