merge these updates

these fixes got a bit out of hand for the branch they were in, but they are good.