Fixed issues with encoding of null values