Fixing sqlite error