fix bug #171: a first attempt

fix bug #171: a first attempt