Fixes issues 7276 and 6386