Added explicit shape checking
Test changes following stricter test criteria