Fixed some functions
Fixed getAip segmentation fault