Made implicit casting work when casting from JS.