Add test, and fix the code ;)