Fix some legacy bugs