fix some minor problems

- make array index unsigned
- leave function if logfile could not be opened