Fix a few bugs with the new data interface

There were some possibilities of NULL pointer dereferencing.  Also,
changed one small function to inline.
Include $ORIGIN in portable mode on unix
Fixup OSX Rpath for imported external libraries on install