This fixes a lot of really odd bugs