fixing some bugs to generate the results