rename_if_needed function

rename if needed