Bug fixes; Test class