fixed compilation errors, there is still a problem with the linking in the newest XCode