Substring bug, pull req details
This fix is probably better