fix, write correct data structure to the output