Fixing saving undefined and null values

Fixes #16