finally, FINALLY solved the problem with tests