Fixed issues related to CLOUDSTACK-5674

Fixed issues mentioned for CLOUDSTACK-5674.
More changes in the bug

Signed-off-by: Santhosh Edukulla <Santhosh.Edukulla@citrix.com>
Signed-off-by: SrikanteswaraRao Talluri <talluri@apache.org>