Avoid instanceof due to Node Webkit dual contexts

Third time lucky? #417