fix memory error
Merge pull request #1 from DoubleRed/master

fix memory error