Finally found the hidden problems and made all the tests pass