add TM modes
rename variable
more io checking on LOG path