Some small improvements to error handling in the factory and config managers