improved update script, was previously hanging