Add checking for missing data

Fixes #18
Merge pull request #21 from richarddmorey/issue18

Add checking for missing data