Fix possible crash in viewing profiles