added an assertion for the number of selected data.