Fix a bug in removing dependency process