fix the broken version, add tests