misc improvements in logging and error conditions