change the slice size automatically