added test, debugged and test passed