Merge pull request #1 from glebb/master

trim after reading config file, fix for linux
basic error handling.