remove debug log, add sorted check