fix Elliptic Curve calculation

it was totally buggy :(