wrote test. fixed bug.