applied Andreas Amann's patch from Oct 2010, thanks