Fix for bug #5163 from Laurent Pinchart <pinchart@skynet.be>