BUG: TS.TDF not allocated
cleanup main
avoid seg fault if mhd file was not found
added support for having output data on the host but not on device