Fix several minor runtime bugs in the app