stricter checks and add tests