Fixing subprocess communication