bug fix, adding more unit tests