Fix bug in subprocess