add tests, fixing #491