[TIMOB-15319] [TIMOB-15265] Backports to 3_1_X

After merging please add fixVersion Release 3.1.4 and remove merge label
JIRA Tickets
[TIMOB-15319](https://jira.appcelerator.org/browse/TIMOB-15319)
[TIMOB-15265](https://jira.appcelerator.org/browse/TIMOB-15265)