fix for a minor bug reported by thoni
fix for 2 minor bugs reported by thoni
fix for another minor bug reported by thoni