timob-12154: Backport: TIMOB-11235

https://jira.appcelerator.org/browse/TIMOB-12154
Test case in https://jira.appcelerator.org/browse/TIMOB-11235