Fix bug with null.asInstanceOf[type].