not sure what a flush() is doing there