"Can't set headers....." when installing app with new version number

Hi,

When I start a test I always install a new apk to ensure that I have the latest version of the app on the device. But when the app has a new version number and it has never been installed on the device before I always get:

error: Unexpected error: Error: Can’t set headers after they are sent.
at ServerResponse.OutgoingMessage.setHeader (http.js:689:11)
at ServerResponse.res.set.res.header (C:\AppiumForWindows\node_modules\appi
m\node_modules\express\lib\response.js:561:10)
at C:\AppiumForWindows\node_modules\appium\lib\server\controller.js:174:11
at safely (C:\AppiumForWindows\node_modules\appium\lib\server\helpers.js:30
:5)
at next (C:\AppiumForWindows\node_modules\appium\lib\server\controller.js:1
3:5)
at C:\AppiumForWindows\node_modules\appium\lib\server\controller.js:190:9
at null. (C:\AppiumForWindows\node_modules\appium\lib\appium.js:
70:7)
at null. (C:\AppiumForWindows\node_modules\appium\lib\devices\an
roid\android.js:129:12)
at C:\AppiumForWindows\node_modules\appium\node_modules\async\lib\async.js:
54:17
at C:\AppiumForWindows\node_modules\appium\node_modules\async\lib\async.js:
57:25 context: [POST /wd/hub/session {“desiredCapabilities”:{“platformName”:“An
roid”,“app”:“Y:\bets10.apk”,“appActivity”:“com.betsson.android.MainActivity”,"
mulator":“false”,“deviceName”:“Galaxy S5”,“takesScreenshot”:true,"platformVer]

If I restart the test it will work, it is only happening the first time.

I run the tests on a real Samsung S5 device. Happens both on android version 4 and 5.
Appium version 1.3.4.1