Minor fixes to Tom's patch