Fix internal toMethod function check