Fix a bug in portlet replacement

Also, I somehow totally screwed my commit history,
Not sure if I broke something accidentally
Repair template

The option was removed, accidentally
Add change notes