make sure count doesn't exceed list length