Add unit test to catch #156 and fix it