Fix dependants not being correctly set in some edge cases.