refine error handling refs #18