Fixed a bunch of bugs,
thanks MightyFordrus!