properly cast value