Fixes issue 8504
Use is_polynomial instead
Merge pull request #8554 from vramana/fix-8504

Fixes issue 8504