more fixes to source for merge