Fixes a couple weird bugs