Fixes second issue for #1221
Fixes #1221
Merge pull request #1245 from ATofighi/fix-1221

Fixes second issue for #1221