Remove duplicated code breaking the template dialog

Change-Id: Ied5dc71106601ab354441c2d81507b616553c0d9
Merge "Remove duplicated code breaking the template dialog"