Internal: rewriteApplication was reimplemented using rewriteMany
New: a smaller test case for #52