Remove unnecessary casting.
Merge pull request #2649 from jburel/rebased/develop/cast-exception

Cast exception (rebased onto develop)