Merge pull request #234 from grtjn/dev

Bug fix for #209, few other bug fixes..