a bunch of other fixes in here, sorry