Fixing problems with gcc 4.4
Making serialize buffer more robust