auth middleware fix