fixed a couple of bugs introduced.