fix bugs and add output displayed