Fixing a couple of bugs that were really bugging the trash out of me