Fixed a crash and fixed autoscrolling to the bottom