Fixed segmentation fault due to undocumented api calls