Fix unloading a weapon from the inventory screen

Closes #993.