Fix adding software to agent

There was a mistake in the code that led to the endpoint fetching the
software version by the software's id instead of the version's id.