handle more cases in identifier resolving