fixed some dispose calls and gc calls