Fix #207, fix tests