updated version of exec-sync