Fixed temporary variables explosion

Also added finalisation of the stacks.

This is absolutely not `opendiff`’s fault.