Fixing a few minor bugs