fixing a bug where an agent couldn't be built with additional permissions
make sure to write files downloaded from the remote in binary mode (windows support)