Make it work when name contains extension.