Fix some reference leaks.
Merge pull request #25 from fkrull/refleaks

Fix some reference leaks.