Add managed const ptr, remove unneeded upcast