Use pid only when needed

We move the pid variable to the inner block to use it only when we
needed.
asciify: Fix uninitialized value

The value of the offset in the proceed function was not initalized
properly hence resulting in an read error when the value was different
from zero.