fix small issues

- make the file reading more flexible for weird filenames
- use actual file apis instead of making it more abstract because of oo-problems