Revert "Remove unneeded double cast"

This reverts commit 3e00add3475fcec3a2a753e26a1468c06ec62334.