Applying JS-194 patch

Applying Martin's patch.