Added better logic to profile2 context plugin