Improve error messaging.
Bug fixes.