fix bugs affecting \marginheightadjustment and \extendmargin