add validation of slice parameters instead of assert