Fix: terribly inefficient query in view_profile.