Fix detect script