Fixed a bug in clearDependencies