On the extension of isometries