Fix occasional exception in diff handling
merging changes

Merge branch 'master-emax' into emax-watcher
small changes form last night