Currency conversion rates wrong with AIF uploaded invoices


I have a site where we upload invoices through the AIF into the invoice register. The XML input file specifies the Currency conversion rate, but this is overwritten when the invoice is uploaded. The actual conversion rate used, seems to be the first one set up for that currency irrespective of what is in the XML files.

I am not sure where to look for the code that will set the currency rate. Can someone point me in the right direction?