Improve error messages from typespecs, closes #1401