more improvements on error messages and shape checks.
8 files changed