added codes to reinsert back values