Fix Class cast Exception (see #9960)
Merge pull request #899 from jburel/rebased/develop/class-cast

Fix Class cast Exception (see #9960) (rebased onto develop)