added debugging code (see e-mail for problem)