fixed memory leak (Dave Wallin)