Implemented a watchdog for issue #534.
Merge pull request #540 from mbrotz/bugfixes

Implemented a watchdog for issue #534.