forceddevicename infinite loop bug fix

Jira Issue: WP-1221