Add cast to work around const issue in new code