#217 adjusted error handling.