Added NULL protections
Updated exports