detect psgi correctly