fix bug and output prettily