fix slicing bug