Fixed #1179
Fix #1190 by @cmsworksru