Fix many more bugs