fixed mem/performance leak