Fix last file input bugs. #932