Merge pull request #845 from timlinux/master

Apply hotfixes and improvments from develop to fix failing jenkins tests.