add errors and tests