Fix writeContentToFile to write content if content already filled