Bug fix for memory leak in r/python code.