Fixing a bug in utils where writing does not check existence first