Bug fix and new test