added wait (thanks to Jaques Frechet)