Fix a bug of slices generation