rework of issue #50. now seems to be fixed