A number of fixes I'm too lazy to list