Fixed the dispose method.