partially handle memory leeks