calls the flushFunction callback