Fixing a few final bugs