Fixed a threading related issue that occurs because  is not thread-safe when used from lambdas.
Merge pull request #46 from ecraft/master

Fixed a threading related issue that occurs because $1 is not thread-safe when used from lambdas