integrate stack in serialization process