Fixed missing includes and formward declarations hidden by cotire.
decode: Do not overflow the chunk buffer

This should resolve bug #225