Remove unnecessary nil checking
Add test for disposing