tweak logging and error handling