minor improvements to error msgs and handling