The Problem was as following:
The code works vor Polynomimals f(x) mod p, where p is prime (or gcd(p,coeff(f(x))) = 1), but I wanted the inverse modulo 32, which is in fact: 2^5, so I had to calculate the inverse mod 2 and then lift it to 2^5
The solution was in thread: inverse of polynomialsinverse of polynomials