A few more MySQL bugs during optimization