fixing some code in the original upload code