final fixes for somewhat botched merge with master