bug fix. should write test.