Fix error: variable 'kw' referenced before assignment

Change-Id: Ife95d74bf645687dc4595b16434c88ee874c2f95
Closes-bug: #1311742