In particular, emit more explicit error messages in the presence of inconsistencies. Closes: #103 (cherry picked from commit 13c29eaa)