logging and a bug fix