Fix #23, add test