timob-12155: Backport: TIMOB-11431

https://jira.appcelerator.org/browse/TIMOB-12155
Test case in https://jira.appcelerator.org/browse/TIMOB-11431