bug fix, thank to Peter Bowey