Fix #210

With tests!