Fixed errors in respect to foreign-arrays.

I used the example files inthe user directory to exercise the code
It now behaves as it should in regard to table building and querying for
both native and foreign arrays.

I need to exercise the fitting and interpolation code next