fixing issue with assuming publichostname inside a VPC instance, adding try/catch