fixed file upload bug and enhanced cmdline debug