Fix ordering when waiting for multiple dependencies