check if value is actually valid before attempting to store it (e.g. null)
Merge pull request #13 from limianwang/master

check if value is actually valid before attempting to store