fixed max.duration()

- circumvented that 'no non-missing arguments to max'
- few other small fixes, e.g., rm() only with existing variables