error message and logging improvements