Fixes error in #568

JIRA ticket: https://jira.appcelerator.org/browse/ALOY-1144
Original PR: https://github.com/appcelerator/alloy/pull/568
Tests: https://gist.github.com/FokkeZB/08165210d279766ef67c