finded bug, fixed tests, added mod_exp and mod_inv functions