Fix caching problems. Need write permission on both input and output