Fixed a polarity change error going from == to is.  Added more robust error-checking for subshape, subcenter, and nearest.