Make inc_hopcount and fp_hopcount safe
Check appdataptr to decide whether to output logs