Fixed bug
Improved test
Added debug