changed how we serialize objects to avoid AOT errors