bunch of misc fixes