figured out issue with write_inflow_block function corrupt stack parameters, now working, moving on to write_ts_block