Supplement to PR #1454 and issue #530. Fixes #3192. Fixes #1861 (introduced by PR #1454). Signed-off-by: Konstantin Gribov <grossws@gmail.com>