fix bug on upload function