invoke_when_ready fix