ref #40 Bug fix