Fixed some memory leaks, considerable amount still unfixed.