Issue 5849 stackoverflow velocity serialize master merge

master merge