fixing a newly introduced bugs in detect.js
fixing a newly introduced bugs in detect.js