Avoid instanceof due to Node Webkit dual contexts

ping #417