updated code for removing path

updated code for removing path