bugfixed, junit test passes