correct and add tests