Cherry pick assert error

Cherry-picked the commits from torch/torch7-distro#184 to the current master of torch/torch7. 

Did so using 
```bash
git remote add old git@github.com:torch/torch7-distro
git cherry-pick -x -X subtree=pkg/torch d1b5c00947d88766fc88d0d967ecb12282305895..74abcfc706
```

where I got the SHA from gitx/git log/tig, whichever you prefer.
Note the `-X subtree=` option, which is the really important bit, and worked because all the modifications were located within a single folder (otherwise it would be messy)
The `-x` adds an extra line to each commit message, with a link to the original commit.