Merge pull request #12317 from s0undt3ch/2014.1

[2014.1] Add tests for #12209
Fix logic