<<why did the FMS not calculate the remaining fuel correctly?>>
Although the FMS will not have the correct performance figures, it will always give a reliable indication of fuel at destination based on what it was told was there at the beginning of the flight and how much has been going through the fuel flowmeters during the flight - which I guess must have been 0 or less ( does it do minus figures?) for quite some time