replaced simple string errors with full Errors, in order to make debugging easier.