Fixed several small but annoying bugs.