Bug #1324: Artem's solution