Avoid infinite loops while converting custom themes