Fixed minor memory leaks.