More logging and exception-handling fixes