Hello. Following patch fixes issues that can be seen with -fsanitize=undefined on GCC 7. Patch was tested with make test. Thanks, Martin