MODE-1853 - Reverted code introduced by MODE-1729 (commit 2e42871) which shows a similar problem to the class cast exception