cache: some fixes for jpg disk storage backend