Fixed some memory leaks
Merge pull request #71 from mshamash/master

Fixed some memory leaks