Fix slice indices computation and support slice pickling