Shell: add missing null check. Fixes #1711.
Uses a snapshot of the reference to Master instead of a proxy

so that the master cannot change all of a sudden in the middle of
operations. This fixes a problem where a service which was instantiated
for one specific master continued to run for a different master after a
sudden master switch. Specifically this resulted in misuse of id ranges,
potentially received from a different master than expected.
Merge pull request #1708 from tinwelint/2.0-cement-master

Uses a snapshot of the reference to Master instead of a proxy
Passes along phase1Timeout payload in all places
Merge pull request #1712 from jotomo/1711

Shell: add missing null check. Fixes #1711.
Fixes #1697

Fixes #1697 which is an issue where replacing a property on an entity
using batch inserter where the property would be bigger than the one it
overwrote so that it would need to go into a new property record. There
would be a NullPointerException due to removing that property block from
the property record two times.
Fixes problem with compiling queries with NOT expressions in them
Merge pull request #1713 from tinwelint/2.0-p1-payload

Passes along phase1Timeout payload in all places
Merge pull request #1703 from tinwelint/2.0-fix-1697

Fixes #1697
Merge pull request #1716 from systay/not-rewrite

Fixes problem with compiling queries with NOT expressions in them