fix bug..write test

etc