fixed user-agent is undefined and force case toLowerCase