Fixed a problem with the dictionary in optimised
mode. Need to be careful about accidentally returning
references to temporaries.