Fix lots of little bugs