Fixed a bunch of things causing problems

general bits and pieces