fix bug that was preventing 'wait' from working