bug fix in sorting cells by levels