tons and tons of bugfixes

good thing I actually checked for bugs before commiting this time