Fix slice out of bounds