mocking subprocess and fix call bug