Better error reporting. Fixes issue #1347

Wow, looks like I finally managed to issue a PR with a clean commit log...