More informative error message. Fixes #638