throw errors instead of strings, modified #clear() internals