Fixed regeneration of token during script upload (fixes #25)