add specs and bug fix