Fixes ENYO-380 (master)

Cherry-picking and merging changes from https://github.com/enyojs/enyo/pull/904 into master.