add test for corner case, fix