fix as in #1606 by @AtIvanov