fix function pointer type
handle non-const global variable