fix bug noticed by @tombentley