Fixing a couple bugs