improved log-file handling