Fix crashes when only one section is in a page

Change-Id: I39061dd77862799cf1c16ca09b8235b2510e29dd