fixed replace function as it was only doing first occurence of a '.' rather than all