fixed the logic to determine caller