Fix the "invalid nonce" problem

the nonce calculation depends on Date.getMilliseconds() which returns a number that's between 1-3 digits long. I added zero-padding to make sure nonce is always increasing