Fixed casting of function pointers