Fix timing of vm waiting for key