Add remaining tests and fixes.