fix IndexError, make changes for unauthenticated users