fix issue #3 with patch proposed by Jul1