Fix detection script