Made cast function unwrap internally