revised the waitforimages