fixed some bugs; added a bit to the testbench