Based on patch by Darcy Watkins <DWatkins@tranzeo.com> Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk>