update algorithm
changed gmt to bcmath as gmp_mod is not correct