Fixing a few bugs, cleanups.