Fix dependecy algorithm one more time