cherry-pick 465425c from develop: Get rid of backwardcompat.fwrite() as it doesn't do what it seems to