Fix some foundbugs.