Fixes a few minor bugs