Add tests and fix the corresponding code