fixed 2 bugs as reported by Brendan Tracey