Improvement of Bertrands fix for #875