Fix bug in kwargs.pop("upload_to") and kwargs.pop("to")