[1.5] Import patch from bug tracker
Thanks to winfried
Fixes issue 304