debugged merge from Frederic-Marchard#1