fixed a fucking truckload of bugs and stuff