applying another patch from @hanspolo