Fix problem with insertion of values.
Improve error messages.