Fixed templates no longer applied

Fixed #669
Fixed wrong permissions sometimes applied

Refs #627