Fixing sqlite issues