fix an npe when generating samples
Merge pull request #155 from devoncarew/devoncarew_fix_npe

fix an npe when generating samples