Fix #255

Fix implementation
Add unit tests
Add IT

Signed-off-by: Clement Escoffier <clement.escoffier@gmail.com>