fix new win detect, fix order colum by, reformat code