Revert "Removed obsolete cast"

This reverts commit 107978273730c91de9882b74fd0325c45f31f9e5.