fixed a couple of bugs.