fixed detect script