Fix unauthorized handling