Fixes a few minor bugs and stupid mistakes.