fix upload path
add upload func
add cwd func
add mutex
fix threading-safe