Properly deal with percent-subtitutions in extend.

Fixes #150.