fixed query when editing profile with multiple groups