You've added a decode, but I see no matching encode.  You should probably do that before the proc returns.