Tightened checking of slicing parameters and added unit tests