Added helper function  apn_strfree()
Fixes bugs