fixing a few small bugs.