all functionalities are now working perfectly, see test.c