fix level, add tests