fix calculation error when min_ls > 0