fixed some issues

typos and garbage collecting
Merge pull request #468 from lloiser/dispose

fixed some issues