This fixes #539
Merge pull request #540 from bobcanthelpyou/bugfixes

This fixes #539