Fixed bug where scrollPosition would sometimes not be initialized.