use callbacks; improve retry; bugfix wait for pid