Strange behavior while slicing