fix returncode

1. Use returncode from process but the default - 0
2. Redirect stderr to PIPE.