fixed plugin memory management issues, so tests should not crash now