writes to ROOT file correctly now