Clean up EC group operations, add missing checks.