Merge pull request #252 from TheMightyBuzzard/master

Fix for the race condition paulej72 described in #136.