fixed exit code

had this problem on my Mac and php55 that when remote script fails, no exit code returns. This commit will fix the issue.