Fixes for merge of Scotts code