Fix #48

And a related tests