fix bug and add automatic scolling