maybe fixed wait loop logic