#533 memory leak fixed