Fixes tests and several other things