Fix issue #1216
Added notnil test for issue #1216
Merge pull request #1279 from Varriount/fix-1216

Fix issue #1216