Make sure the cast operators for string values don't throw

The underlying methods here could throw, these are now caught and 0
will be returned instead.