Added more test for file uploading and fixed a bug