bunch of cleanup fixes