fix the nil bug when first loading sample data