updated a minor bug  and added a test.
updated test