bug fix and added tests