More bug fixes and better error messages.