shape Junit test + bugfixes