Fixed minor bugs all over the place