applied a patch by mjp++ (rt96494)