Some cleanups and fixes.