Fixing race condition on monitor, issue #42

Fixing race condition on issue #42