added more error checking code
more error checking
Merge branch 'master' into inter-slices