initial patch from Roman & Norbert