Some random minor fixes. I think one of them is a crash.