Prevent 'maybe uninitialized error' and improve error handling
Remove some old files
Merge pull request #274 from bastih/master

Mini fixes and cleanups