Fix error in generation of ctl.conf

Ticket: #5240
(cherry picked from commit 539708ff40334d56b438736f599eb50f4d8de909)