adding changes from torch-android