Fix resolving of substitutions in fragments
Add a couple more difficult with resolution tests