Added patch from nickm for gcc4 support. Added virtual destructors that gcc4 warned about, correcting memory leak in Stateful in the process. Taybin