Fixed boundary bugs.