Fix crash

This change fixes the crash in the simulator. I'm not even sure if that is a bug or not, because maybe "self" shouldn't be there in a different thread. But retaining the reference in a dummy variable fixes the crash.
Merge pull request #1 from tkadauke/patch-1

Fix crash