change wait to poll