computation of gcm finally works