implemented solution for p18: slice. I wonder if it actually works...
prevented the slice from going forever