issue #27: adjust exit status and wait calculation