fix memory management bug
Merge pull request #1 from joshuastray/develop

fix memory management bug