Fixed encoding of assoc arrays and undefined