more general approach for finish (which is now called finalize)
very small bug fix