manually added #8 from iirekm/master