Bug fix, implement test