fixed bug and cleaned up tests