Fixed errors

The only problem now is after uploading a file, the client does not
increment the message number for some reason. It works after every other
file call.