Issue #34: added some diagnostic code to investigate the problem