More informative error message. Fixes #638
Merge branch 'fix-638' into develop