Fixed file upload and fixed tests