Avoid instanceof due to Node Webkit dual contexts

Ping #417