Added tests
Bug fix