added logging statements to track down bug