Cluster scaling bug fixing

And a little code improvement

Fixes: bug #1202562

Change-Id: I5786278575a93fc731d5b47341beafb79337973b