Fix various problems.