Fixed template editing and saving
Fixed template macro expansion