apply modified patch from #130 (provided by @schneider42, fix #130)