updated device detect script