Minor fixes, including an off by one error.