Fixed broken tests
Fix more bugs