Merge pull request #687 from tonyrd/master

a few hot fixes, see commits