Fix dispose call throwing exception if called during setup