Fixed a bug
Improved the tests