Fix for issue #29 provided by sxua