capacity was not respected

Updated to properly calculate the amount of free space in the tank
before checking that against the amount of the resource.