Fix issue with count_on_hand attribute in sample loading (#2631)