Bug # 1973: Change write to ast_carefulwrite