deployment script: better error handling, make correct remote dirs

Change-Id: I59474ed0bea6303a002a9eb0e207b1954d4b6811