This and the next bit were copied from the ZoneToEndpoint class in jclouds core. (Just a note in case you want to make the fix there as well).