Fixed the problem, now to make tests.