Multiple fixes

https://github.com/WindowsAzure/azure-sdk-tools-xplat/issues/1082
https://github.com/WindowsAzure/azure-sdk-tools-xplat/issues/1081