restore needed cast to correct type with const