fix the issue based on tests