Imported some fixes I've added to my dev environment.