added coalesce to ensure we get IDs for all profiles