Fix slice error on certain intervals