script should wait now properly