Oops, fix encode_object to actually work!