fixed,added tests