removed redundant casts and as_slice()