Fix issue #881
Fix issue #881

The code is a mess so I'm not 100% sure it is correct now, but in any
case it's an improvement because we fixed issue 881.

liblouis/liblouis,BueVest/liblouis,liblouis/liblouis,hammera/liblouis,BueVest/liblouis,liblouis/liblouis,BueVest/liblouis,liblouis/liblouis,hammera/liblouis,liblouis/liblouis,hammera/liblouis,hammera/liblouis,hammera/liblouis,BueVest/liblouis,hammera/liblouis,BueVest/liblouis,liblouis/liblouis,BueVest/liblouis