fixed a bunch of bugs found during actual testing