Minor impr to error handling