junit test and bug fix