Fix bug when v is < 1000000 and substr fails
Fix bug when v is < 1000000 and substr fails

For v less 1m e.g. 12345 previous code would try to get substr(-1,6). This happens once in 2130 attempts.
Daplie/botp,javraindawn/notp,Daplie/botp,AgentME/notp,guyht/notp