Fixes #20  cannot dispose of undefined