Added leakless typecasting for strings

Not sure if you like it.