fixed a few boundary bugs