Fixed bugs in searching for dependencies