- fix problems reported by Thomas Prem