part of the fixes for the previous merge, to start
second part of fixes for the previous merge