elgamal: more fixes. if you read this, I've been too lazy to clean up the history.