Fix issue 1791