make serialize api more friendly