A couple of bugfixes
Merge branch 'master' into gh-pages