fix incorrect subprocess handling