more logging printouts, and a few error fixes