Reimplementing cast from dynamic to string [ci skip]