fix infinite infobar bug and bug if filename already exists