Xrf fit

The changes above _should_ remove the need for the type casting.