Build version advanced to 3985-138
Build version advanced to 3985-140
CLOUDIFY-1397 minor refactoring, protect against illegal situation by throw illegal state