fixed a ton of bugs