Thanks for pointing me out this issue Visnu. There was indeed an issue with rounding numbers that I fixed. I still have an issue with odd numbers of slices for some reason. Forcing even subdivision for now. I'll figure out the problem later when I have a more time.