more changes pulled from torch-android