some light fixes plus some junit test cases