[trunk] Import patch from bug #241