apply fixes from version 1.8 to master