minor changes to dispose