Fixed a load of bugs in pretty-much everything