Fixes to the handling of the Rascal 'extend'. Fixes #507.