Fixes a load of stuff